package com.example.back.controller;

import com.example.back.dto.req.TransactionListReq;
import com.example.back.dto.resp.TransactionListResp;
import com.example.back.service.TransactionService;
import com.example.common.support.Result;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 财务管理
 */
@RestController
@Api(tags = "财务管理")
@RequestMapping("/Finance/Transaction")
public class TransactionController {
    @Resource
    private TransactionService transactionService;

    @ApiOperation(value = "获取交易记录", notes = "获取交易记录")
    @PostMapping(value = "/list")
    public Result<PageInfo<TransactionListResp>> list(@RequestBody TransactionListReq req) {
        return Result.success(transactionService.list(req));
    }

    @ApiOperation(value = "导出交易记录", notes = "导出交易记录")
    @PostMapping(value = "/TransactionExportXls")
    public Result<Object> TransactionExportXls(@RequestBody TransactionListReq req) {
        return Result.success(transactionService.TransactionExportXls(req));
    }
}

